<?php

namespace MyApp\Controllers\Admin;

use MyApp\Models\Admin;
use Phalcon\Mvc\Controller;

class ControllerBase extends Controller
{
    public function initialize()
    {
        $id = session("id");
        $password = session("password");
        $admin = Admin::findFirst($id);
        if ($admin->password != password($password)) {
            return $this->response->redirect('admin/login/index');
        }
    }

    public function afterExecuteRoute()
    {
        //$this->view->setViewsDir($this->view->getViewsDir() . 'admin/');
    }
}
